<template>
    <div class="self">
    	<div class="self-logo flex-column">
    		<div class="picture">
    			<img src="../../assets/img/logo.png" alt="" />
    		</div>
    		<div class="username">{{userInfo.userName}}</div>
    	</div>
        <ul>
            <li>
                <div class="label">真实姓名</div>
                <span>{{userInfo.userRealName}}</span>
            </li>
             <li>
                <div class="label">部门</div>
                <span>{{userInfo.deptName}}</span>
            </li>
            <li>
                <div class="label">职务</div>
                <span>{{userInfo.post}}</span>
            </li>
            <router-link tag="li" to="/about">
                <div class="label">关于</div>
                <span class="iconfont iconyoujiantou"></span>
            </router-link>
        </ul>
        <div class="loginout">
            <button @click="loginout">退出登录</button>
        </div>
    </div>
</template>

<script>
    export default {
        name: "index",
        data(){
            return {
				userInfo:{}
            }
        },
        mounted() {
			this.userInfo = this.$store.state.userinfo;
			console.log(this.userInfo)
        },
        methods:{
            loginout(){
                localStorage.removeItem('token');
                sessionStorage.removeItem('token');
                this.$router.replace({
                    path:'/login'
                })
            }
        }
    }
</script>

<style scoped lang="less">
    .self{
        background: #e6e6e6;
        position: relative;
        overflow: hidden;
        .self-logo{
        	height:150px;
        	background: red;
        	.picture{
        		width: 80px;
        		height:80px;
        		background: white;
        		border-radius: 50%;
        		padding: 3px;
        		img{
        			width: 100%;
        			height:100%;
        			border-radius: 50%;
        		}
        	}
        	.username{
        		font-size: 15px;
        		color:white;
        	}
        }
        li{
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 14px;
            background: white;
            height: 40px;
            margin-top: 15px;
            font-size: 15px;
            span{
                color:#999;
            }
        }
        .loginout{
            width: 100%;
            position: absolute;
            bottom:20px;
            text-align: center;
            button{
                width: 200px;
                height:30px;
                border-radius: 5px;
                background: red;
                font-size: 15px;
                color:white;
            }
        }

    }
</style>